package com.workspace.repository;

import com.workspace.daomain.Customers;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

//@Repository
public interface CustomerRepository extends JpaRepository<Customers,Integer> {
//    登录验证
    @Query(value = "select * from customers  where username=?1",nativeQuery = true)
    public Customers findCustomersByUsername(String username);
    //用户列表输出
    @Query(value = "select * from customers",nativeQuery = true)
    public List<Customers> findAllCustomers();
    //用户删除
    @Modifying
    @Transactional
    public int deleteCustomersBySid(String sid);
}
